﻿
var dateType = 1;
$(function () {
    get_list(1);
    get_list2(1)
    $('.switch_tab li').click(function () {
        $('.switch_tab li').removeClass("current");
        $(this).addClass('current');
        dateType = $(this).attr('data-type');
        get_list(1);
        get_list2(1)
    })
})

function get_list(ty) {
    //alert(1);
    if (ty == 1) {
        $('#table_list').html("");
    }
    else { }
    $.ajax({
        type: "post",
        url: "/agentcenter/GetHhrTGFX ",
        data: {
            agentType: 1,
            dateType: dateType
        },
        dataType: "json",
        success: function (data) {
            if (data.State) {
                var list = data.Datas;
                var content = "";
                for (var i = 0; i < list.length; i++) {
                    content += " <tr> ";
                    content += "<td>" + list[i].DateTime + "</td>";
                    content += "<td>" + list[i].Type + "</td>";
                    content += "<td>" + list[i].ClickNum + "</td>";
                    content += "<td>" + list[i].PayNum + "</td>";
                    content += "<td>" + list[i].Estimate + "</td>";
                    content += "<td>" + list[i].Income + "</td>";
                    content += "<td>" + list[i].UserName + "</td>";

                    content += "</tr>";
                }
                if (list.length > 0) {
                    $('#table_list').append(content);
                    pi++;
                }
                else {
                    //$('#nodate').show();
                    $('#table_list').append("<tr><td colspan=7>暂无信息</td></tr>");
                }
            }
        },
        error: function (data) {
        }
    })
}
function get_list2(ty) {
    //alert(1);
    if (ty == 1) {
        $('#table_list2').html("");
        pi = 1;
    }
    else { }
    $.ajax({
        type: "post",
        url: "/agentcenter/GetHhrTGFX ",
        data: {
            agentType: 2,
            dateType: dateType
        },
        dataType: "json",
        success: function (data) {
            if (data.State) {
                var list = data.Datas;
                var content = "";
                for (var i = 0; i < list.length; i++) {
                    content += " <tr> ";
                    content += "<td>" + list[i].DateTime + "</td>";
                    content += "<td>" + list[i].Type + "</td>";
                    content += "<td>" + list[i].ClickNum + "</td>";
                    content += "<td>" + list[i].PayNum + "</td>";
                    content += "<td>" + list[i].Estimate + "</td>";
                    content += "<td>" + list[i].Income + "</td>";
                    content += "<td>" + list[i].UserName + "</td>";
                    content += "</tr>";
                }
                if (list.length > 0) {
                    $('#table_list2').append(content);

                }
                else {
                    //$('#nodate').show();
                    $('#table_list2').append("<tr><td colspan=7>暂无信息</td></tr>");
                }
            }

        },
        error: function (data) {
        }
    })
}
